import request from '@/utils/request';
import Qs from 'qs';

/**
 * 昨日24小时每小时建联数量
 * @param data
 * @returns {*}
 */
export const hourMerchant = () => {
  return request({
    url: '/basic/dataScreening/hourMerchant',
    method: 'post'
  });
};

/**
 * 昨日各部门品类分析（可选时间）
 * @param data
 * @returns {*}
 */
export const eachepartment = (data: { startTime?: string; endTime?: string }) => {
  return request({
    url: '/basic/dataScreening/compartment',
    method: 'post',
    data
  });
};

/**
 * 昨日建联商家及较前日涨幅数量（可选时间）
 * @param data
 * @returns {*}
 */
export const connectionMerchant = (data: { startTime?: string; endTime?: string }) => {
  return request({
    url: '/basic/dataScreening/connectionMerchant',
    method: 'post',
    data
  });
};

/**
 * 昨日新增商品及较前日涨幅数量（可选时间）
 * @param data
 * @returns {*}
 */
export const commodityCount = (data: { startTime?: string; endTime?: string }) => {
  return request({
    url: '/basic/dataScreening/commodityCount',
    method: 'post',
    data
  });
};

/**
 * 管理员pc：招商选品榜
 * @param data
 * @returns {*}
 */
export const investmentSelection = (data: { startTime?: string; endTime?: string }) => {
  return request({
    url: '/basic/dataScreening/investmentSelection',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
};

/**
 * 管理员pc：招商部数据
 * @param data
 * @returns {*}
 */
export const attractData = () => {
  return request({
    url: '/basic/dataScreening/attractData',
    method: 'post'
  });
};

/**
 * 管理员pc：主播选品榜
 * @param data
 * @returns {*}
 */
export const anchorSelection = (data: { startTime?: string; endTime?: string }) => {
  return request({
    url: '/basic/dataScreening/anchorSelection',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
};

/**
 * 建联商家数据统计列表
 * @param data
 * @returns
 */
export const merchantList = (data: { dept?: string; name?: string; isContract?: string | number }) => {
  return request({
    url: '/basic/dataScreening/merchantList',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
};

/**
 * 新增商品数据统计列表
 * @param dept 招商部
 * @param name 招商元
 * @param isAdd 有无新增 0无 1有
 * @param isAudit 有无待送审 0无 1有
 * @param isTime 有无超期 0无 1有
 * @param orderByColumn 排序列
 * @param isAsc 排序的方向desc或者asc
 * @returns {*}
 */
export const commodityList = (data: {
  dept?: string;
  name?: string;
  isAdd?: number;
  isAudit?: string;
  isTime?: string;
  orderByColumn?: string;
  isAsc?: string;
}) => {
  return request({
    url: '/basic/dataScreening/commodityList',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
};
